package com.giraffe.common.jpa.web.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.util.Date;

/**
 * @Author ldx
 * @Date 2023/02/06 10:36
 **/
@Data
@MappedSuperclass
public class IdOpEntity extends IdEntity {

  /**
   * 创建时间
   */
  @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_EMPTY)
  //@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @Column(name = "create_time" , length = 20, columnDefinition = "datetime COMMENT '创建时间 '")
  private Date createTime;

  /**
   * 创建人账号
   */
  @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_EMPTY)
  @Column(name = "create_account" , length = 60, columnDefinition = "varchar(60) COMMENT '创建人账号'")
  private String createAccount;

  /**
   * 创建人名称
   */
  @TableField(fill = FieldFill.INSERT,updateStrategy = FieldStrategy.NOT_EMPTY)
  @Column(name = "create_name" , length = 60, columnDefinition = "varchar(60) COMMENT '创建人名称'")
  private String createName;

  /**
   * 修改时间
   */
  @TableField(fill = FieldFill.UPDATE,updateStrategy = FieldStrategy.NOT_EMPTY)
  //@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  @Column(name = "modify_time" , length = 20, columnDefinition = "datetime COMMENT '修改时间'")
  private Date modifyTime;

  /**
   * 修改人账号
   */
  @TableField(fill = FieldFill.UPDATE,updateStrategy = FieldStrategy.NOT_EMPTY)
  @Column(name = "modify_account" , length = 60, columnDefinition = "varchar(40) COMMENT '修改人账号'")
  private String modifyAccount;

  /**
   * 修改人名称
   */
  @TableField(fill = FieldFill.UPDATE,updateStrategy = FieldStrategy.NOT_EMPTY)
  @Column(name = "modify_name" , length = 60, columnDefinition = "varchar(60) COMMENT '修改人名称'")
  private String modifyName;

}
